#pragma once
#include "Unit.h"
#include "Melee.h"
#include "Texture.h"
#include "FiniteStateMachine.h"
#include "Arrow.h"

class CRange : public CUnit
{
private:
	static int RangeCounter;
	int RangeCount;
	char *str;
	char *rolestr;
	char* Message;
	CUnit* Target;
	const  float ChargeTime;
	float Charge;
	int ShieldHealth;
	int FullShield;
	float StunCoolDown;
public:
	enum State {
		STATE_IDLE= 0, // first
		STATE_CHASE,
		STATE_CHARGE,
		STATE_ATTACK,
		STATE_GUARD,
		STATE_STUN,
		STATE_RECOVERING,
		STATE_HEAL,
		STATE_REPLACING,
		STATE_TOTAL // last
	};

	enum Role
	{
		ROLE_DPS,
		ROLE_HEALER,
		ROLE_TOTAL
	};

	Role role;
	State state;
	static Texture UnitTexture;

	CRange(State state = STATE_IDLE);
	~CRange();

	void ChangeState();
	void Respond(float dt);
	void Update(float Time);
	void Render(void);
	void UnitInteraction(CUnit*);
	void PrintState(int x, int y, float r, float g, float b, char *str);
	void DealDamageTo(CUnit*);
	void RenderShield(void);
	void SetShield(int ShieldHealth);
	int GetShield(void);
	int GetFullShield(void);
	int GetRangeCount(void);
	void ShieldTo(CUnit*);

	int ReturnCount(void){ return RangeCount;}
	void CheckMessage(std::vector<MessageBoard*> &Msgb);
};